#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void meanu(){
    printf("********###菜单###*****\n");
    printf("***********1.play******\n");
    printf("***********0.exit******\n");
    printf("***********************\n");

}
void game(){
    int r =rand() % 10+1;//确定范围
    int g = 0;
    while (1){
        printf("请猜数字:");
        scanf("%d",&g);
        if (g < r){
            printf("猜小了！");
            
        }else if (g > r)
        {
            printf("猜大了");
        }else{
            printf("猜对了");
            break;
        }
    }
    }

int main (){
    int input = 0;
    srand((unsigned int)time(NULL));
    do{
        meanu();
        printf("请选择:");
        scanf("%d",&input);
        switch(input)
        {
        case 1:
            game();
            break;
        case 0:
            break;
        default:
            printf("选择错误\n");
            break;
        }
    }while(input);
    
    return 0;
}